﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:WinFormControlHost ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
    xmlns:WinFormControl ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    xmlns:s="clr-namespace:System;assembly=mscorlib" 
    xmlns:Toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit"
            x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.WorkflowManagerModule.SchedulerView"
    xmlns:Controls="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner;assembly=Microsoft.Research.ScientificWorkflow.UIDesigner"
    Title="SchedulerView"
    Width="950" Height="780"     
    ResizeMode="NoResize" ShowInTaskbar="False" WindowStyle="None" BorderBrush="#FF717171" BorderThickness="2" WindowStartupLocation="CenterScreen" Background="#FFFFFFFF" SizeToContent="Manual">

    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <Controls:DeleteEnabledConverter x:Key="deleteEnabledConverter"></Controls:DeleteEnabledConverter>
        <DataTemplate x:Key="ComboboxTemplate">
            <TextBlock Text="{Binding Path=Name}"/>
        </DataTemplate>
        
        
        <DataTemplate x:Key="ParametersDataTemplate">
            <StackPanel>
                <TextBlock Text="{Binding Mode=OneWay, XPath=parameterName}"/>
                <TextBlock Text="{Binding Mode=OneWay, XPath=parameterValue}"/>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>

   

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="28"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <Border Name="brdrHeader" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="0" CornerRadius="4,4,0,0" Margin="0,0,0,0">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFF7F7F7" Offset="0"/>
                    <GradientStop Color="#FFE9E9E9" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" Foreground="#FF5F5F5F" Text="{Binding Path=WorkflowName}" TextWrapping="Wrap"/>
                <Button Command="{Binding Path=CloseScheduleWindowCommand}" HorizontalAlignment="Right" Margin="0,5.5,5,5.5" Style="{DynamicResource PopupCloseButton}" Width="17" x:Name="closeWindow" AutomationProperties.AutomationId="schedulerWindowCloseButton" />
            </Grid>

        </Border>
        <Grid Grid.Row="1" Grid.RowSpan="1" Background="#FFFFFFFF">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.6*" />
                <ColumnDefinition Width="0.4*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="220" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Border Margin="10,10,10,10" BorderBrush="#FFD0D0D0" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Grid.ColumnSpan="2">
                <Border x:Name="composerHost" BorderBrush="#FFD0D0D0" BorderThickness="0,0,0,0" CornerRadius="5,5,5,5"/>
            </Border>
            <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Grid.Row="1" Grid.Column="1" Margin="10,0,10,10">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                <GradientStop Color="#FFE8E8E8" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Workflow Required Parameters" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
                    </Border>
                    <Border Grid.RowSpan="1" Grid.Row="1" Margin="5,5,5,5" x:Name="PropertyPaneHost">
                    </Border>
                </Grid>
            </Border>
            <Grid Grid.Row="1" Background="#FFFFFFFF">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" MinHeight="134.332"/>
                    <RowDefinition Height="Auto" MinHeight="50"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" HorizontalAlignment="Stretch" d:LayoutOverrides="Height" Margin="10,0,0,10">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                    <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Details" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
        					</Grid>
                        </Border>
                        <Grid HorizontalAlignment="Stretch" Margin="5,2,5,5" Grid.Row="1" Grid.RowSpan="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto" MinHeight="0"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="80"/>
                                <ColumnDefinition Width="190"/>
                                <ColumnDefinition Width="65"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="Job Name:" TextWrapping="Wrap" Grid.ColumnSpan="1" Grid.RowSpan="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,5,0"/>
        					<TextBlock Text="Node:" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Row="1" Margin="0,5,5,0"/>
        					<ComboBox SelectedItem="{Binding Path=SelectedMachine}" ItemsSource="{Binding Path=NodeList}" ItemTemplate="{StaticResource ComboboxTemplate}" IsSynchronizedWithCurrentItem="True" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" Width="175" AutomationProperties.AutomationId="nodeComboBox" DropDownOpened="OnMachineListDropDownOpened">
        					</ComboBox>
        					<TextBox MaxLength="75" MaxLines="1" VerticalAlignment="Center" Text="{Binding Path=JobName}" TextWrapping="NoWrap" Grid.Column="1" HorizontalAlignment="Left" Width="175" AutomationProperties.AutomationId="jobNameTxtBox"/>
        					<TextBlock Text="Schedule By:" TextWrapping="Wrap" HorizontalAlignment="Right" d:LayoutOverrides="Height" Grid.Row="2" VerticalAlignment="Top" Margin="0,5,5,0"/>
        					<ComboBox SelectedItem="{Binding Path=SelectedUser}" ItemsSource="{Binding Path=UserList}"  ItemTemplate="{StaticResource ComboboxTemplate}"  IsSynchronizedWithCurrentItem="True" d:LayoutOverrides="Height" Grid.Column="1" Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,5,0,0" Width="175" AutomationProperties.AutomationId="usersCombobox"/>
        					
        					<TextBox Text="{Binding Path=Notes}" MaxLines="4" MaxLength="250" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Stretch"  Margin="0,5,0,0" Width="175" Grid.Column="3" Grid.RowSpan="3" AutomationProperties.AutomationId="ScheduleNotes" VerticalScrollBarVisibility="Auto" />
        					<TextBlock Text="Notes:" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" HorizontalAlignment="Right" Margin="0,5,5,0" VerticalAlignment="Top" Grid.Column="2"/>
        				</Grid>
                    </Grid>
                </Border>
                <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" d:LayoutOverrides="Height" Grid.Row="2" Margin="10,0,0,10" Grid.RowSpan="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                    <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Additional Parameters" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
        					</Grid>
                        </Border>
                        <Grid Grid.Row="1" Grid.RowSpan="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="30"/>
                            </Grid.RowDefinitions>
                            <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" CornerRadius="0,0,5,5" Grid.Row="1" BorderThickness="0,1,0,0" BorderBrush="#FFE4E4E4">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                        <GradientStop Color="#FFEAEAEA" Offset="0.991"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,5,0">
                                    <Button Content="Delete" Width="60" Margin="0,0,5,0" Command="{Binding Path=DeleteAdditionalParameterCommand}" CommandParameter="{Binding ElementName=dataGrid, Path=SelectedItem}">
                                        <Button.IsEnabled>
                                            <MultiBinding Converter="{StaticResource deleteEnabledConverter}">
                                                <Binding ElementName="dataGrid" Path="HasItems"></Binding>
                                                <Binding ElementName="dataGrid" Path="SelectedItem"></Binding>
                                            </MultiBinding>
                                        </Button.IsEnabled>
                                    </Button>
                                    <Button Content="Add" Width="60" Command="{Binding Path=AddAdditionalParameterCommand}"/>
                                </StackPanel>
                            </Border>
                            <Toolkit:DataGrid Margin="5,5,2,5" Height="80" Grid.RowSpan="1" x:Name="dataGrid" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False"  CanUserAddRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding Path=AdditionalParameters}" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray" SelectionMode="Single">
                                <Toolkit:DataGrid.Columns>
                                    <Toolkit:DataGridTextColumn Width="160" Binding="{Binding Path=Domain}" Header="Domain"></Toolkit:DataGridTextColumn>
                                    <Toolkit:DataGridTextColumn Width="173" Binding="{Binding Path=Parameter}" Header="Parameter Name"></Toolkit:DataGridTextColumn>
                                    <Toolkit:DataGridTextColumn Width="190" Binding="{Binding Path=ParameterValue}" Header="Parameter Value"></Toolkit:DataGridTextColumn>
                                </Toolkit:DataGrid.Columns>
                            </Toolkit:DataGrid>
                        </Grid>
                    </Grid>
                </Border>
                <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" HorizontalAlignment="Stretch" Margin="10,0,0,10" d:LayoutOverrides="Height" Grid.Row="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                    <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Schedule Details" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
        					</Grid>
                        </Border>
                        <Grid HorizontalAlignment="Stretch" Margin="5,2,5,5" Grid.Row="1" Grid.RowSpan="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" MinHeight="20"/>
                                <RowDefinition Height="Auto" MinHeight="20"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid Width="Auto" HorizontalAlignment="Stretch" Grid.Row="0" Margin="0,5,0,0" VerticalAlignment="Top">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Border Margin="0,0,10,0" BorderBrush="#FFD0D0D0" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Padding="0,0,0,0" Grid.Column="1" HorizontalAlignment="Stretch">
                                    <Grid Margin="5,10,5,10">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="94"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <StackPanel Margin="0,0,0,0">
                                            <RadioButton Content="OneTime" IsChecked="{Binding Path=OnetimeRecurrence}" Margin="5,0,0,0" x:Name="onetimeSelection" AutomationProperties.AutomationId="onetimeRadioButton" />
                                            <RadioButton Content="Daily" IsChecked="{Binding Path=DailyRecurrence}" Margin="5,5,0,0" x:Name="dailySelection"  AutomationProperties.AutomationId="dailyRadioButton"/>
                                            <RadioButton IsChecked="{Binding Path=WeeklyRecurrence}" Margin="5,5,0,0" x:Name="weeklySelection" Content="Weekly" AutomationProperties.AutomationId="weeklyRadioButton"/>
                                        </StackPanel>
                                        <Border Background="{x:Null}" CornerRadius="0,0,0,0" Padding="10,0,0,0" HorizontalAlignment="Stretch" Grid.Column="1" BorderBrush="#FFB9B9B9" BorderThickness="1,0,0,0" Margin="0,0,0,0" Height="70">
                                            <Grid>
                                                <Grid Visibility="{Binding Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=weeklySelection, Mode=OneWay}" AutomationProperties.AutomationId="weekGrid" >
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" MinHeight="70"/>
                                                    </Grid.RowDefinitions>
                                                    <StackPanel VerticalAlignment="Top">
                                                        <WrapPanel Margin="0,0,0,5" Width="Auto">
                                                            <TextBlock Text="Recur every" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,0,5,0" Foreground="#FF000000"/>
        													<TextBox Text="{Binding Path=RecurInWeeks}" x:Name="weekRecur" TextWrapping="NoWrap" Width="30" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,5,0" MaxLength="2" PreviewKeyDown="TextBox_PreviewKeyDown" AutomationProperties.AutomationId="weeklyRecurrenceTxtBox"/>
        													<TextBlock Text="weeks on" TextWrapping="Wrap" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF000000"/>
        												</WrapPanel>
                                                        <WrapPanel HorizontalAlignment="Stretch" Orientation="Horizontal" Width="360" AutomationProperties.AutomationId="weekDaysPanel">
                                                            <CheckBox Content="Sunday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsSunday}" AutomationProperties.AutomationId="sundayChkBox" />
                                                            <CheckBox Content="Monday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsMonday}" AutomationProperties.AutomationId="mondayChkBox"/>
                                                            <CheckBox Content="Tuesday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsTuesday}" AutomationProperties.AutomationId="tuesdayChkBox"/>
                                                            <CheckBox  Content="Wednesday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsWednesday}" AutomationProperties.AutomationId="wednesdayChkBox"/>
                                                            <CheckBox  Content="Thursday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsThursday}" AutomationProperties.AutomationId="thursdayChkBox"/>
                                                            <CheckBox Content="Friday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsFriday}" AutomationProperties.AutomationId="fridayChkBox"/>
                                                            <CheckBox  Content="Saturday" Width="80" Margin="0,0,0,2" IsChecked="{Binding Path=IsSaturday}" AutomationProperties.AutomationId="saturdayChkBox"/>
                                                        </WrapPanel>
                                                    </StackPanel>
                                                </Grid>
                                                <Grid Visibility="{Binding Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=dailySelection, Mode=OneWay}" AutomationProperties.AutomationId="dailyGrid" >
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" MinHeight="70"/>
                                                    </Grid.RowDefinitions>
                                                    <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" AutomationProperties.AutomationId="weekDaysPanel">
                                                        <TextBlock Text="Recur every" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,5,0" Background="{x:Null}" Foreground="#FF000000"/>
        												<TextBox Text="{Binding Path=RecurInDays}" x:Name="daysRecur" TextWrapping="NoWrap" Width="30" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,5,0" MaxLength="3" PreviewKeyDown="TextBox_PreviewKeyDown" AutomationProperties.AutomationId="dailyRecurrenceTxtBox"/>
        												<TextBlock Text="day(s)" TextWrapping="Wrap" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Background="{x:Null}" Foreground="#FF000000"/>
        											</WrapPanel>
                                                </Grid>
                                            </Grid>
                                        </Border>
                                    </Grid>
                                </Border>
                                <TextBlock VerticalAlignment="Top" Text="Recurrence:" TextWrapping="Wrap" d:LayoutOverrides="Width" HorizontalAlignment="Right" Margin="0,5,5,0"/>
        					</Grid>
                            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" MinHeight="21" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="Start Date:" TextWrapping="Wrap" Margin="0,5,5,0"/>
        						<TextBlock HorizontalAlignment="Right" Text="End Date:" TextWrapping="Wrap" d:LayoutOverrides="Height" VerticalAlignment="Top" Grid.Row="1" Margin="0,5,5,0"/>
        						<WinFormControlHost:WindowsFormsHost Grid.Column="1" HorizontalAlignment="Left" Width="200" Margin="1,1,1,0" >
                                        <WinFormControl:DateTimePicker x:Name="startDateControl" Margin="5,0,2,0" CustomFormat="MMMM dd, yyyy hh:mm:s tt" Format="Custom" />
                                    </WinFormControlHost:WindowsFormsHost>
                                    <WinFormControlHost:WindowsFormsHost IsEnabled="{Binding Path = IsExpireEnabled}" Width="200" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Margin="1,1,1,0" >
                                        <WinFormControl:DateTimePicker x:Name="endDateControl" Margin="5,0,2,0" CustomFormat="MMMM dd, yyyy hh:mm:ss tt" Format="Custom"/>
                                    </WinFormControlHost:WindowsFormsHost>
        						<CheckBox IsChecked="{Binding Path=IsExpireEnabled}" Content="Expire" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Grid.Column="1" Grid.Row="1" Margin="220,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
        					</Grid>
                        </Grid>
                    </Grid>
                </Border>
            </Grid>
        </Grid>
        <Border CornerRadius="0,0,5,5" BorderThickness="1,1,1,1" BorderBrush="#FFE4E4E4" VerticalAlignment="Stretch" Grid.Row="2">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFF0F0F0" Offset="0"/>
                    <GradientStop Color="#FFD2D2D2" Offset="0.991"/>
                </LinearGradientBrush>
            </Border.Background>
            <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
                <Button IsDefault="True" Content="Save" Width="70" Margin="0,0,5,0" Command="{Binding Path=SaveScheduleCommand}" IsEnabled="{Binding Path = IsValidData}" />
                <Button IsCancel="True" Content="Cancel" Width="70" Command="{Binding Path=CloseScheduleWindowCommand}"/>
            </StackPanel>
        </Border>
    </Grid>
</Window>
